package com.tykj.yangningyu.chatdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 作者：yangningyu on 2016/12/29 10:15
 * 邮箱：13315169475@163.com
 * 用于别的类进行继承
 */

public abstract class BaseActivity extends AppCompatActivity {

    private Unbinder bind;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        int layoutId = getLayoutId();
        setContentView(layoutId);
        //绑定butterknife
        bind = ButterKnife.bind(this);
        initView();
    }

    protected abstract void initView();

    public abstract int getLayoutId();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //解除绑定
        bind.unbind();
    }
}
